package ioc17;

import org.springframework.beans.propertyeditors.CustomDateEditor;

import java.beans.PropertyEditorSupport;

public class AddressEditor extends PropertyEditorSupport {

    /**
     *
     * @param text 江苏省-南京市
     * @throws IllegalArgumentException
     */
    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        Address addr=new Address();
        String[] s=text.split("-");
        addr.setProvince(s[0]);
        addr.setCity(s[1]);
        setValue(addr);
    }
}
